package nc.ui.test.view;

import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;

import javax.swing.JLabel;
import javax.swing.JPanel;

import nc.bs.framework.common.NCLocator;
import nc.itf.test.IStringServer;

public class MyStringPanel extends JPanel {

	private static final long serialVersionUID = 1L;
	private JLabel jLabel = null;

	/**
	 * This is the default constructor
	 */
	public MyStringPanel() {
		super();
		initialize();
	}

	/**
	 * This method initializes this
	 * 
	 * @return void
	 */
	private void initialize() {
		GridBagConstraints gridBagConstraints = new GridBagConstraints();
		gridBagConstraints.gridx = 0;
		gridBagConstraints.gridy = 0;
		this.setSize(300, 200);
		this.setLayout(new GridBagLayout());
		this.add(getJLabel(), gridBagConstraints);
	}

	/**
	 * This method initializes jLabel	
	 * 	
	 * @return javax.swing.JLabel	
	 */
	private JLabel getJLabel() {
		if (jLabel == null) {
			jLabel = new JLabel();
			
			IStringServer server = NCLocator.getInstance().lookup(IStringServer.class);
			
			String houtaiStr = server.print();
			
			jLabel.setText(houtaiStr);
		}
		return jLabel;
	}

}
